﻿/*
 * Created by SharpDevelop.
 * User: CrOnO
 * Date: 03/10/2011
 * Time: 10:32 p.m.
 * 
 * To change this template use Tools | Options | Coding | Edit Standard Headers.
 */
using System;
using System.Drawing;
using System.Windows.Forms;
using System.ComponentModel;
using System.Collections.Generic;
using Business_Logic;
using Business_Entity;

namespace PetSoft.GUI.RRHH
{
	/// <summary>
	/// Description of GUIReporteCalendario.
	/// </summary>
	public partial class GUIReporteCalendario : Form
	{
		private Form ventanaPopUp;
		
		public GUIReporteCalendario()
		{
			//
			// The InitializeComponent() call is required for Windows Forms designer support.
			//
			InitializeComponent();
			this.nombreTB.KeyPress += new KeyPressEventHandler(Utils.SoloLetrasTB);
            this.apPaternoTB.KeyPress += new KeyPressEventHandler(Utils.SoloLetrasTB);
            this.apMaternoTB.KeyPress += new KeyPressEventHandler(Utils.SoloLetrasTB);
            this.docIdentidadTB.KeyPress += new KeyPressEventHandler(Utils.SoloNumerosTB);
			
            this.cargoCB.Items.AddRange(new object[] {
									"<Seleccionar>"});
			this.cargoCB.Text = "<Seleccionar>";
			//
			// TODO: Add constructor code after the InitializeComponent() call.
			//
		}
		
		private void cerrarPopUp(object sender, EventArgs e){
			this.ventanaPopUp = null;
		}
		
		
		
		void mostrarCalendarioClick(object sender, EventArgs e)
		{
			if (ventanaPopUp == null){				
				GUIMostrarReporteCalendario ventanaCalendario = new GUIMostrarReporteCalendario();
				this.ventanaPopUp = ventanaCalendario;
				this.ventanaPopUp.Closed += new System.EventHandler(this.cerrarPopUp);
				this.ventanaPopUp.Show();
			}
		}
		
		void habilitarCargo(object sender, EventArgs e)
        {
        	try
			{
	        	if (areaCB.Text != "<Seleccionar>")
	        	{
	        		this.sexoCB.Text = "<Seleccionar>";
	        		
	        		this.cargoCB.Enabled = true;
	        		this.cargoCB.Items.Clear();
	        		this.cargoCB.Items.AddRange(new object[] {
										"<Seleccionar>"});
	        		
	        		BLCargo bl = new BLCargo();
	        		  		 
	        		List<BECargo> lista = bl.obtenerCargo(this.areaCB.Text);
	        		
	        		if (lista != null)
		        	{
	        			for(int i=0; i<lista.Count; i++)
	        				this.cargoCB.Items.Add(lista[i].Descripcion);
	        			this.cargoCB.Text = "<Seleccionar>";
		        	}
		        	else
		        	{
		        		//MessageBox.Show("Error cargando datos de la BD","Error");
		        	}
		        }
	        	else
	        	{
	        		this.cargoCB.Enabled = false;
	        	}
			}
			catch
			{
			}
        }
		
		void GUIReporteCalendarioLoad(object sender, EventArgs e)
		{
			try
			{
	        	this.sexoCB.Text = "<Seleccionar>";
				BLArea bl = new BLArea();
	  	
	        	List<BEArea> lista = bl.obtenerArea();
	   	
	          	if (lista != null)
	        	{
	          		for(int i=0; i<lista.Count; i++)
	        			this.areaCB.Items.Add(lista[i].Descripcion);
	          		this.areaCB.Text = "<Seleccionar>";
	        	}
	        	else
	        	{
	        		//MessageBox.Show("Error cargando datos de la BD","Error");
	        	}
			}
			catch
			{
			}
		}
		
		void limpiarClick(object sender, EventArgs e)
		{
			try
			{
				this.nombreTB.Text = "";
				this.apPaternoTB.Text = "";
				this.apMaternoTB.Text = "";
				this.areaCB.Text = "<Seleccionar>";
				this.cargoCB.Text = "<Seleccionar>";
				this.docIdentidadTB.Text = "";
				this.sexoCB.Text = "<Seleccionar>";
			}
			catch
			{
			}
		}
	}
}
